<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        /* 使用div的一半来 */
        /* #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            position: relative;
            margin: 0 auto;
        }
        #child {
            width: 150px;
            height: 100px;
            background: orange;
            position: absolute;
            top: 50%;
            left: 50%;
            margin: -50px 0 0 -75px;
            line-height: 100px;
        } */
        /* 使用translate */
        /* #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            position: relative;
            margin: 0 auto;
        }
        #child {
            width: 100px;
            height: 100px;
            background: #93BC49;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        } */
        /* 使用0000 margin auto */
        /* #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            position: relative;
            margin: 0 auto;
        }
        #child {
            width: 200px;
            height: 100px;
            background: #A1CCFE;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            line-height: 100px;
        } */
        /* 通过上下padding 关键点父元素不能设置高*/
        /* #box {
            width: 300px;
            background: #ddd;
            padding: 100px 0;
            margin: 0 auto;
        }
        #child {
            width: 200px;
            height: 100px;
            background: #F7A750;
            line-height: 50px;
        } */
        /* 使用flex布局 */
        /* #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            display: flex;
            flex-direction: column;
            justify-content: center;
            margin: 0 auto;
        }
        #child {
            width: 300px;
            height: 100px;
            background: #08BC67;
            line-height: 100px;
        } */
        /* vertical-align让图片垂直居中 */
        #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            margin: 0 auto;
            line-height: 300px;
        }
        #child {
            width: 300px;
            height: 100px;
            /* background: #08BC67; */
            /* display: inline-block; */
            text-align: center;
            vertical-align: middle;
        }
        /* 使用display table */
        #box {
            width: 300px;
            height: 300px;
            background: #ddd;
            display: table;
            margin: 0 auto;
        }
        #child {
            /* width: 100px;
            height: 100px;
            background: #ff5c5c; */
            display: table-cell;
            vertical-align: middle;
        }
    </style>
</head>
<body>
        <div id="box">
                <div id="child">我是测试DIV</div>
                <!-- <img src="./images/swiper-prev.png" alt=""> -->
        </div>
</body>
</html>